using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Test.MyUtils.WeakDelegate
{
	public class SimpleToSimpleSubscriber<T> : EventSubscriber<T> where T : EventPublisher
	{
		readonly SimpleEventPublisher _publisher;

		public SimpleToSimpleSubscriber(SimpleEventPublisher publisher)
		{
			_publisher = publisher;
		}

		public override void Subscribe()
		{
			_publisher.EventSimple += Handler;
		}

		public override void Unsubscribe()
		{
			_publisher.EventSimple -= Handler;
		}

		void Handler()
		{
			InvokationCount++;
		}
	}
}